home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / test / suplib / insert.c < prev    next >
C/C++ Source or Header  |  1992-10-25  |  415b  |  21 lines

  1.  
  2. #include <stdio.h>
  3. #include <suplib/lists.h>
  4.  
  5. void
  6. Insert(struct List *list, struct Node *node, struct Node *lnode)
  7. {
  8.     /*
  9.      *  Insert node after lnode.  If lnode == NULL then insert 
  10.      *  at head of list.
  11.      */
  12.  
  13.     if (lnode == NULL)
  14.     lnode = (struct Node *)&list->lh_Head;
  15.     node->ln_Pred = lnode;
  16.     node->ln_Succ = lnode->ln_Succ;
  17.     lnode->ln_Succ = node;
  18.     node->ln_Succ->ln_Pred = node;
  19. }
  20.  
  21.